package com.sxx.beautifulcity.database;

import com.sxx.beautifulcity.entity.greendao.LoginUserDaoEntity;
import com.sxx.beautifulcity.entity.greendao.LoginUserDaoEntityDao;
import com.sxx.beautifulcity.entity.greendao.UserDaoEntity;
import com.sxx.beautifulcity.entity.greendao.UserDaoEntityDao;

import java.util.List;

/**
 * Created by dllo on 15/11/7.
 */
public class LoginUserHelper {
    private LoginUserDaoEntityDao entityDao;
    private DaoSingleton instance = DaoSingleton.getInstance();

    public LoginUserHelper() {
        entityDao = instance.getLoginUserDao();
    }


    public void savaLoginUser(List<LoginUserDaoEntity> list){
        entityDao.insertInTx(list);
    }

    public void deleteAll(){
        entityDao.deleteAll();
    }

    public List<LoginUserDaoEntity> queryAll(){
       return entityDao.loadAll();
    }
    public List<LoginUserDaoEntity> queryName(String name){
        List<LoginUserDaoEntity> list = entityDao.queryBuilder().where(LoginUserDaoEntityDao.Properties.User_login_name.eq(name)).list();
        return list;
    }
}
